package com.aurora.oa.work.view;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.aurora.oa.R;
import com.aurora.oa.activity.BaseActivity;
import com.aurora.oa.listener.OnRequestCompanyStructureDataListener;
import com.aurora.oa.listener.OnRequestPatrollogDetailListener;
import com.aurora.oa.model.RequestHttpModel;
import com.aurora.oa.model.RequestHttpModelImpl;
import com.aurora.oa.utils.ToastUtil;
import com.aurora.oa.work.bean.PatrollogBean;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/5/2 0002.
 */
public class PatrollogDetailActivity extends BaseActivity {
    @Bind(R.id.tv_shop_name)
    TextView tvShopName;
    @Bind(R.id.tv_patroll_person)
    TextView tvPatrollPerson;
    @Bind(R.id.tv_patroll_time)
    TextView tvPatrollTime;
    @Bind(R.id.tv_sell_money)
    TextView tvSellMoney;
    @Bind(R.id.tv_remark)
    TextView tvRemark;
    String id;
    RequestHttpModel model = new RequestHttpModelImpl();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initTitlebar(true, "巡店日志详情", true);
        setMyContentView(R.layout.activity_patrollog_detail);
        ButterKnife.bind(this);
        getData();
    }

    private void getData() {
        id = getIntent().getStringExtra("id");
        model.getPatrollogDetail(id, new OnRequestPatrollogDetailListener() {
            @Override
            public void onRequestPatrollogDetailSuccess(PatrollogBean patrollogBean) {
                initView(patrollogBean);
            }

            @Override
            public void onRequestPatrollogDetailFail(String message) {
                ToastUtil.show(PatrollogDetailActivity.this,message);
            }
        });

    }

    private void initView(PatrollogBean patrollogBean) {
        tvShopName.setText(patrollogBean.shopname);
        tvPatrollPerson.setText(patrollogBean.realname);
        tvPatrollTime.setText(patrollogBean.createtime);
        tvSellMoney.setText(patrollogBean.sales);
        tvRemark.setText(patrollogBean.remark);
    }
}
